struct Solution {}

fn main() {}

impl Solution {
    pub fn row_and_maximum_ones(mat: Vec<Vec<i32>>) -> Vec<i32> {
        let mut cnt_vec: Vec<(i32, i32)> = vec![];
        let mut idx = 0;
        mat.iter().for_each(|line| {
            cnt_vec.push((idx, line.iter().filter(|&e| *e == 1).count() as i32));
            idx += 1;
        });
        cnt_vec.sort_by(|a, b| if (*a).1 != (*b).1 { (*b).1.cmp(&(*a).1) } else { ((*a).0.cmp(&(*b).0)) });
        let ret = cnt_vec.get(0).unwrap();
        vec![ret.0, ret.1]
    }
}